package com.sinoair.worker.repository;

import com.sinoair.worker.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * demo-vue
 * ${desc}
 * <pre>
 *  Version         Date            Author          Description
 * ---------------------------------------------------------------------------------------
 *  1.0.0           2017/08/05     senlin        -
 * </pre>
 *
 * @author senlin
 * @version 1.0.0 2017/8/5 0005 9:15
 * @date 2017/8/5 0005 9:15
 * @since 1.0.0
 */

@Repository
public interface UserRepository extends JpaRepository<User, Long> {

    List<User> findByName(String name);

    List<User> findByAddress(String address);

    List<User> findByNameAndAddress(String name, String address);

    @Query("select p from User p where p.name=:name and p.address=:address")
    List<User> withNameAndAddressQuery(@Param("name") String Name, @Param("address") String address);


}
